#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, d, k;
vector<int> ids[N];
int cnt[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> d >> k;
  rep(i, 1, n) {
    int t, id;
    cin >> t >> id;
    ids[t].push_back(id);
  }
  set<int> ans;
  rep(t, 0, 1e5) {
    if (t >= d) {
      int t0 = t - d;
      for (int id : ids[t0]) cnt[id]--;
    }
    for (int id : ids[t]) {
      if (++cnt[id] >= k) ans.insert(id);
    }
  }
  for (int id : ans) cout << id << endl;
  return 0;
}